home *** CD-ROM | disk | FTP | other *** search
- ASK.COM - Batch file utility sets ERRORLEVEL according to user input.
-
- Published in Programmers Journal Vol 3, No. 2 by Dan Rollins
- Modified for both IBM and Victor 9000 compatibility by Guy Gordon 6/4/85
-
- sytax:
-
- ASK prompt-string
-
- The prompt-string is displayed followed by 1 space, then the
- program pauses till a key is pressed. If the key is acceptable
- it is displayed, (followed by CR) and ERRORLEVEL is set.
- Otherwise a beep is sounded and the program continues to wait.
-
- valid | returned
- replies | ERRORLEVEL
- ------------------------
- ESC | 0
- 0 q Q F10 | 0
- 1 y Y F1 | 1
- 2 n N F2 | 2
- 3 F3 | 3
- . . | .
- . . | .
- 9 F9 | 9
-
- Example usage in a batch file:
-
- echo off
- rem *** powerup menu for AAAA Managerial Consultants, Inc. ***
-
- :START
- cls
- echo ================= M E N U ================
- echo = =
- echo = [1] Lotus 1-2-3 =
- echo = =
- echo = [2] Wordstar =
- echo = =
- echo = [3] Manage-Man Menu =
- echo = =
- echo = =
- echo = [Q] Quit and exit to DOS =
- echo = =
- echo ==========================================
- echo ^I
- echo ^I
- ask Select option or Quit (1,2,3, or Q):
- if not errorlevel 1 goto QUIT
- if not errorlevel 2 goto 123
- if not errorlevel 3 goto WS
- if not errorlevel 4 goto MM
- echo ^I
- echo ^G invalid response!
- goto START
-
- :MM
- cd \mm
- manager
- cd \
- goto START
-
- :WS
- cd \wp\ws
- mode com1:12,n,8,1,p >NUL
- mode lpt1:=com1 >NUL
- ws
- cd \
- goto START
-
- :123
- cd \lotus
- 123
- cd \
- goto START
-
- :QUIT
- cls
- echo ======= Exiting to PC DOS ========
- echo == enter MENU to return to menu ==
- echo ==================================
-